﻿using UnityEngine;
using System.Collections;

public class CloudControl : MonoBehaviour
{
	//VARIABLES
		//Floats
			float cloudTrans; //defines cloud movement direction
	
		//Transforms
			public Transform clouds;
	
	//FUNCTIONS
		void Start()
			{
				cloudTrans = 1;
			}
	
		void Update()
			{
				clouds.position = new Vector3 (Mathf.Lerp (clouds.position.x, 50 * cloudTrans, Time.smoothDeltaTime * .035f),7,40);
			}
	
		void LateUpdate()
			{
				//Reverse cloud movement direction
					if (clouds.position.x >= 25)
						cloudTrans = -1;
		
					if (clouds.position.x <= -25)
		 				cloudTrans = 1;
			}
}
